package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author pengq
 */
@Setter
@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "用户", description = "平台注册用户模型")
@JsonIgnoreProperties(value = {"handler"})
public class User extends BaseDomain {
    /**
     * 保密
     */
    public static final int GENDER_SECRET = -1;
    /**
     * 男
     */
    public static final int GENDER_MAN = 1;
    /**
     * 女
     */
    public static final int GENDER_WOMAN = 0;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 昵称
     */
    @ApiModelProperty(value = "昵称", name = "nickName", dataType = "String", required = true)
    private String nickName;
    /**
     * 密码
     */
    private String password;
    /**
     * 地区
     */
    private String place;
    /**
     * 头像
     */
    private String headImgUrl;
    /**
     * 性别
     */
    private Integer gender = GENDER_SECRET;
    /**
     * 背景图
     */
    private String coverImgUrl;
    /**
     * 签名
     */
    private String sign;
    /**
     * 用户绑定的手机
     */
    private String phoneNumber;
    /**
     * 用户积分
     */
    @ApiModelProperty(value = "用户积分", name = "grade", dataType = "int", required = true)
    private int grade;
    /**
     * 用户游记
     */
    private List<Travel> urls = new ArrayList<>();
    /**
     * 游记总数
     */
    private int countNum;

    public String getGenderName() {
        if (gender == GENDER_WOMAN) {
            return "女";
        } else if (gender == GENDER_MAN) {
            return "男";
        } else {
            return "保密";
        }
    }

}